﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MvcPractice.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        /// <summary>
        /// 此方法是直接返回另外一个方法，但是有源代码
        /// </summary>
        //public ActionResult Index(string year,string month,string day,string id)
        //{
        //    return Content(id);
        //}

        /// <summary>
        /// 此方法也是直接返回，但没有源代码 直接通过url字段链接地址进行显示
        /// </summary>
        /// <returns></returns>
        public string Index()
        {
            return "你好，世界！";
        }
        //public string ADD()
        //{
        //    return "你好，又一个世界！";
        //}
        /// <summary>
        /// 返回一个视图,里面有参数的话返回home里的页面
        /// </summary>
        /// <returns></returns>
        public ViewResult About()
        {
            ViewData["Data1"] = "这是Data1";
            ViewBag.Data2 = "这是Data2";

            var model = new Class()
            {
                ClassID = 1,
                ClassName = "java班"

            };
            ViewBag.Class = model;
            return View();
        }
        public ViewResult De()
        {
            var mo = new Class()
            {
                ClassID = 2,
                ClassName = "asp.net班"
            };
            return View(mo);
        }
       
    }
}